# $Id$
# Maintainer: Timothy Redaelli <timothy.redaelli@gmail.com>
# Contributor: Andy Weidenbaum <archbaum@gmail.com>

pkgname=bfgminer
pkgver=3.0.0
pkgrel=1
pkgdesc="Bitcoin miner featuring overclocking, monitoring, fan speed control and remote management. For FPGA/GPU/CPU Bitcoin mining."
arch=('i686' 'x86_64')
depends=('curl' 'jansson')
optdepends=('opencl-nvidia: OpenCL implementation for NVIDIA'
            'opencl-catalyst: OpenCL implementation for AMD')
url='https://bitcointalk.org/index.php?topic=168174.0'
license=('GPL3')
options=(!libtool)
source=(http://luke.dashjr.org/programs/bitcoin/files/$pkgname/$pkgver/$pkgname-$pkgver.tbz2
        change-kernel-path.patch
        remove-dangerous-rpath.patch)
sha256sums=('86f7f977ed57b8d61c728f88a3e5962aa1df0723d667c45b1e1bfa5152292400'
            'a551f73a430809a9b13bb535a503d24f8fd6d35a07bc579b5616d270a1bbf369'
            '2c6d09a5e567f5099c9b117415013bf28e7b7aa75c436515d28bc7640f905db2')

[[ "$CARCH" == "x86_64" ]] && makedepends+=('yasm')

build() {
  cd "$srcdir"/$pkgname-$pkgver

  patch -p0 < "${srcdir}"/change-kernel-path.patch
  patch -p0 < "${srcdir}"/remove-dangerous-rpath.patch
  autoreconf -fi
  ./configure --prefix=/usr --enable-cpumining --enable-scrypt
  make
}

package() {
  cd "$srcdir"/$pkgname-$pkgver

  make DESTDIR="$pkgdir" install
}
